package com.xy.biz.fd.domain.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Greekn Zhang
 * @date 2021/6/16 14:15
 * @description
 */
// TODO 文档字典表数据发生更改时需要改动此类
public class DocumentPropertyUtils {
    private DocumentPropertyUtils() {
    }

    /**
     * 等级-第一层级文件
     */
    public final static String LEVEL_1 = "1";
    /**
     * 等级-第二层级文件
     */
    public final static String LEVEL_2 = "2";
    /**
     * 等级-第三层级文件
     */
    public final static String LEVEL_3 = "3";
    /**
     * 属性-质量手册
     */
    public final static String PROPERTY_QM = "QM";
    /**
     * 属性-程序文件
     */
    public final static String PROPERTY_CX = "CX";
    /**
     * 属性-管理规程
     */
    public final static String PROPERTY_SM = "SM";
    /**
     * 属性-操作规程
     */
    public final static String PROPERTY_SO = "SO";
    /**
     * 属性-规则
     */
    public final static String PROPERTY_GZ = "GZ";
    /**
     * 属性-质量标准及检验规程
     */
    public final static String PROPERTY_ST = "ST";
    /**
     * 属性-记录
     */
    public final static String PROPERTY_JL = "JL";
    /**
     * 属性-其它
     */
    public final static String PROPERTY_QT = "QT";
    /**
     * 属性-图纸
     */
    public final static String PROPERTY_TZ = "TZ";

    public final static Map<String, String> documentPropertiesMap = new HashMap<>();

    public final static Map<String, String> levelsMap = new HashMap<>();

    public final static Map<String, Integer> levelNumsMap = new HashMap<>();

    public final static Map<Integer, List<String>> levelMap = new HashMap<>();

    public final static List<String> propertiesListOfLevel1 = new ArrayList<>();

    public final static List<String> propertiesListOfLevel2 = new ArrayList<>();

    public final static List<String> propertiesListOfLevel3 = new ArrayList<>();

    static {
        documentPropertiesMap.put(PROPERTY_QM, "质量手册");
        documentPropertiesMap.put(PROPERTY_CX, "程序文件");
        documentPropertiesMap.put(PROPERTY_SM, "管理规程");
        documentPropertiesMap.put(PROPERTY_SO, "操作规程");
        documentPropertiesMap.put(PROPERTY_GZ, "规则");
        documentPropertiesMap.put(PROPERTY_ST, "质量标准及检验规程");
        documentPropertiesMap.put(PROPERTY_JL, "记录");
        documentPropertiesMap.put(PROPERTY_QT, "其它");
        documentPropertiesMap.put(PROPERTY_TZ, "图纸");

        levelsMap.put(PROPERTY_QM, "第一层级文件");
        levelsMap.put(PROPERTY_CX, "第二层级文件");
        levelsMap.put(PROPERTY_SM, "第三层级文件");
        levelsMap.put(PROPERTY_SO, "第三层级文件");
        levelsMap.put(PROPERTY_GZ, "第三层级文件");
        levelsMap.put(PROPERTY_ST, "第三层级文件");
        levelsMap.put(PROPERTY_JL, "第三层级文件");
        levelsMap.put(PROPERTY_QT, "第三层级文件");
        levelsMap.put(PROPERTY_TZ, "第三层级文件");

        levelNumsMap.put(PROPERTY_QM, 1);
        levelNumsMap.put(PROPERTY_CX, 2);
        levelNumsMap.put(PROPERTY_SM, 3);
        levelNumsMap.put(PROPERTY_SO, 3);
        levelNumsMap.put(PROPERTY_GZ, 3);
        levelNumsMap.put(PROPERTY_ST, 3);
        levelNumsMap.put(PROPERTY_JL, 3);
        levelNumsMap.put(PROPERTY_QT, 3);
        levelNumsMap.put(PROPERTY_TZ, 3);

        propertiesListOfLevel1.add(PROPERTY_QM);

        propertiesListOfLevel2.add(PROPERTY_CX);

        propertiesListOfLevel3.add(PROPERTY_SM);
        propertiesListOfLevel3.add(PROPERTY_SO);
        propertiesListOfLevel3.add(PROPERTY_GZ);
        propertiesListOfLevel3.add(PROPERTY_ST);
        propertiesListOfLevel3.add(PROPERTY_JL);
        propertiesListOfLevel3.add(PROPERTY_QT);
        propertiesListOfLevel3.add(PROPERTY_TZ);

        levelMap.put(1, propertiesListOfLevel1);
        levelMap.put(2, propertiesListOfLevel2);
        levelMap.put(3, propertiesListOfLevel3);
    }

    public final static String getProperty(String code) {
        return documentPropertiesMap.get(code);
    }

    public final static String getLevel(String code) {
        return levelsMap.get(code);
    }

    public final static Integer getLevelNum(String code) {
        return levelNumsMap.get(code);
    }

    public final static List<String> getPropertiesOfLevel(Integer num) {
        return levelMap.get(num);
    }
}
